/*
 * Author: ahxgw
 * Created Time:  Thu 14 Apr 2011 10:59:46 PM PDT
 * Description: 
 */
#include "proto.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/epoll.h>
#include <fcntl.h>
#include <string.h>
#include <pthread.h>
#include <mysql/mysql.h>
#include <errno.h>
#include <vector>
#include <map>
#include <string>
using namespace std;

struct Node
{
    int fd;
    int state;
    msgHead msgh;
    char content[BUF_SIZE];
    Node (int x) 
    {
        fd = x;
        state = 0;
    }
};

struct pipeNode
{
    int fd;
	msgHead msgh;
	char content[BUF_SIZE];
	pipeNode (int x, msgHead h, char *s)
	{
        fd = x;
		msgh = h;
		strcpy(content, s);
	}
};

struct userTable
{
    int fd;
    char UID[LEN];
	char nickname[LEN];
    char pIP[LEN];
    char uIP[LEN];
    char mask[LEN];
	int HB;
    bool iswai;
    vector<string> friends;
};

extern const int MaxThread;
extern int epfd;
extern int pfd1[], pfd2[];

extern pthread_t stid[];

extern int UID;

extern struct pipeNode* nodeBuf[];
extern int qh, qe;

extern MYSQL mysql;

extern map<string, userTable> onlineList;
